home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / vol_400 / 422_01 / libcf / string4.asm < prev    next >
Encoding:
Assembly Source File  |  1994-03-27  |  355 b   |  15 lines

  1. *
  2. * Search for character in string: strchr(string, chr)
  3. *
  4. strchr    LDI    4,S        Get pointer to string
  5. ?1    LDB    I        Get character from string
  6.     JZ    ?2        End of string
  7.     CMP    2,S        Does it match?
  8.     JNZ    ?3        Yes, we found it
  9.     LEAI    1,I        Skip to next
  10.     SJMP    ?1        No, keep looking
  11. ?2    CMP    2,S        Are we looking for zero
  12.     JZ    ?4        No, return 0
  13. ?3    TIA            Get pointer
  14. ?4    RET
  15.